
// 基于ts 的工厂模式
interface obj {
  name: string;
  sayName: () => {};
}

function creatPerson(name: string) {
  const o = new Object() as obj;
  o.name = name;
  o.sayName = function () {
    return `hello world, ${name}`;
  };
  return o;
}
creatPerson("qujun");


